package com.example.DataSource.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.DataSource.Mapper.CAMapper;
import com.example.DataSource.entity.consultantApplication;
import com.example.DataSource.serviceImpl.CAServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/ljkDemo/CA")//CA: 咨询预约管理
public class CAController {
    @Autowired
    private CAMapper caMapper;
    @Autowired
    private CAServiceImpl caService;

    @GetMapping("/getAll")
    public IPage<consultantApplication> getAll(int current, int size){
        Page<consultantApplication> page = new Page<>(current, size);
        return caService.getCAPage(page);
    }

    @GetMapping("/search")
    public IPage<consultantApplication> search(int current, int size,String searchInfo){
        Page<consultantApplication> page = new Page<>(current, size);
        return caService.getCAPageSearch(page,searchInfo);
    }

    @GetMapping("/deleteInfo")
    public void delete(String id){
        caService.removeById(id);
    }

}
